package com.base.home.adapter;


import com.base.commonlib.recy.HolderTypeData;
import com.base.home.bean.ConcertSelectEntity;
import com.base.home.bean.TitleBean;

import java.util.ArrayList;
import java.util.List;

/**
 */
public class MainData {
    public static List<HolderTypeData> getMainFragmentDatas(ConcertSelectEntity concertSelectEntity,boolean isFirst,String parentId){

        List<HolderTypeData> datas = new ArrayList<HolderTypeData>();

        if (isFirst) {
            CateViewHolder cateViewHolder = new CateViewHolder();

            cateViewHolder.setData(concertSelectEntity.getFunctions());

            datas.add(cateViewHolder);

            TitleViewHolder mTitleHolder = new TitleViewHolder();
            TitleBean mTitleBean = new TitleBean();
            mTitleBean.setName("最新动态");
            mTitleHolder.setData(mTitleBean);
            datas.add(mTitleHolder);
        }

        for (ConcertSelectEntity.RecentLearnBean bean : concertSelectEntity.getRecentLearn()){
            if (bean.getType()==1){
                NewViewHolder mNewViewHolder = new NewViewHolder(parentId);
                mNewViewHolder.setData(bean);
                datas.add(mNewViewHolder);
            }else if (bean.getType()==0){
                CourViewHolder mCarViewHolder = new CourViewHolder();
                mCarViewHolder.setData(bean);
                datas.add(mCarViewHolder);
            }else {
                CourViewHolder mCarViewHolder = new CourViewHolder();
                mCarViewHolder.setData(bean);
                datas.add(mCarViewHolder);
            }
        }

//        CoursewareViewHolder mCourseWareHolder = new CoursewareViewHolder();
//        mCourseWareHolder.setData(concertSelectEntity.getRecentLearn());
//        datas.add(mCourseWareHolder);

        return datas;
    }
    public static List<HolderTypeData> appendMainFragmentDatas(List<ConcertSelectEntity.RecentLearnBean> list,String parentId){

        List<HolderTypeData> datas = new ArrayList<HolderTypeData>();

        for (ConcertSelectEntity.RecentLearnBean bean : list){
            if (bean.getType()==1){
                NewViewHolder mNewViewHolder = new NewViewHolder(parentId);
                mNewViewHolder.setData(bean);
                datas.add(mNewViewHolder);
            }else if (bean.getType()==0){
                CourViewHolder mCarViewHolder = new CourViewHolder();
                mCarViewHolder.setData(bean);
                datas.add(mCarViewHolder);
            }else {
                CourViewHolder mCarViewHolder = new CourViewHolder();
                mCarViewHolder.setData(bean);
                datas.add(mCarViewHolder);
            }
        }
        return datas;
    }
}
